#include "astraldef.h"

#define DEFINE_STATUS(s) [s] = #s,

static const char *status[255] = {
    DEFINE_STATUS(BLOCKED)
    DEFINE_STATUS(FINISH)
    DEFINE_STATUS(READY)
    DEFINE_STATUS(CREATED)
    DEFINE_STATUS(RESUMED)
    DEFINE_STATUS(PREEMPTED)
    DEFINE_STATUS(SLICEUP)
    DEFINE_STATUS(RUNNING)
    DEFINE_STATUS(RUNNING1)
    DEFINE_STATUS(RUNNING2)
};

const char* get_task_status(AstralTask t)
{
    if(!t)
    {
        return NULL;
    }
    return status[t->status & 0xff];
}